#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n,t,sum=0;
  cin>>n;
  vector<vector<int>>arr(n);
  vector<int>p(n,0);
  p[0]=1;
  for(auto& x:arr){
    cin>>t;
    x.resize(t);
    for(auto& y:x){
      cin>>y;
      y--;
    }
  }
  for(auto& x:arr[0]){
    p[x]=1;
    for(auto& y:arr[x]){
      p[y]=1;
    }
  }
  for(auto&x:p)sum+=x;
  cout<<sum;
}